package ishitong.vehicleManagement.dao;

import ishitong.vehicleManagement.model.ImportantVehicleAudit;
import com.ishitong.platform.common.dao.GenericDao;
import com.ishitong.platform.common.page.Page;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository;
import ishitong.vehicleManagement.model.ImportantVehicleAuditQuery;
import java.util.List;
import java.util.ArrayList;

/** @pdOid 6c1dbadf-c2f7-442b-8b0d-f4bb99c6784e
 * @创建日期:2013-10-11 15:26:06
 * 
 * @功能描述:ImportantVehicleAudit
 * @开发人员:福建视通 */
@Repository(value="importantVehicleAuditDao")
public class ImportantVehicleAuditDao extends GenericDao<ImportantVehicleAudit> {
   /** @param query 
    * @param pageSize 
    * @param pageNum
    * @pdOid 2760a632-3af1-458c-85e8-f5798ed9c04e
    * @功能描述: 通过ImportantVehicleAuditQuery对象，查询ImportantVehicleAudit
    * @异常类型: */
   public Page findPage(ImportantVehicleAuditQuery query, int pageSize, int pageNum) {
   	StringBuilder hql=new StringBuilder();
   	hql.append(" from ImportantVehicleAudit ett where 1=1");
   	List param=new ArrayList();
   	if(query!=null){
   		if(!StringUtils.isEmpty(StringUtils.trimToEmpty(query.getId()))){
   			hql.append(" and ett.id=?");
   			param.add(query.getId().trim());
   		}
   		if(!StringUtils.isEmpty(StringUtils.trimToEmpty(query.getAuditResultId()))){
   			hql.append(" and ett.auditResultId=?");
   			param.add(query.getAuditResultId().trim());
   		}
   		if(!StringUtils.isEmpty(StringUtils.trimToEmpty(query.getDescription()))){
   			hql.append(" and ett.description=?");
   			param.add(query.getDescription().trim());
   		}
   		if(!StringUtils.isEmpty(StringUtils.trimToEmpty(query.getInsertUserId()))){
   			hql.append(" and ett.insertUserId=?");
   			param.add(query.getInsertUserId().trim());
   		}
   		if(query.getInsertTime()!=null){
   			hql.append(" and ett.insertTime=?");
   			param.add(query.getInsertTime());
   		}
   		if(!StringUtils.isEmpty(StringUtils.trimToEmpty(query.getUpdateUserId()))){
   			hql.append(" and ett.updateUserId=?");
   			param.add(query.getUpdateUserId().trim());
   		}
   		if(query.getUpdateTime()!=null){
   			hql.append(" and ett.updateTime=?");
   			param.add(query.getUpdateTime());
   		}
   	}
   	return this.findByHql(hql.toString(), pageSize, pageNum, param.toArray());
   }
   
   /** @param query
    * @pdOid 7d7b88a2-f071-42f4-a13f-62401263d0d2
    * @功能描述: 通过ImportantVehicleAuditQuery对象，查询ImportantVehicleAudit
    * @异常类型: */
   public List<ImportantVehicleAudit> findList(ImportantVehicleAuditQuery query) {
   	StringBuilder hql=new StringBuilder();
   	hql.append(" from ImportantVehicleAudit ett where 1=1");
   	List param=new ArrayList();
   	if(query!=null){
   		if(!StringUtils.isEmpty(StringUtils.trimToEmpty(query.getId()))){
   			hql.append(" and ett.id=?");
   			param.add(query.getId().trim());
   		}
   		if(!StringUtils.isEmpty(StringUtils.trimToEmpty(query.getAuditResultId()))){
   			hql.append(" and ett.auditResultId=?");
   			param.add(query.getAuditResultId().trim());
   		}
   		if(!StringUtils.isEmpty(StringUtils.trimToEmpty(query.getDescription()))){
   			hql.append(" and ett.description=?");
   			param.add(query.getDescription().trim());
   		}
   		if(!StringUtils.isEmpty(StringUtils.trimToEmpty(query.getInsertUserId()))){
   			hql.append(" and ett.insertUserId=?");
   			param.add(query.getInsertUserId().trim());
   		}
   		if(query.getInsertTime()!=null){
   			hql.append(" and ett.insertTime=?");
   			param.add(query.getInsertTime());
   		}
   		if(!StringUtils.isEmpty(StringUtils.trimToEmpty(query.getUpdateUserId()))){
   			hql.append(" and ett.updateUserId=?");
   			param.add(query.getUpdateUserId().trim());
   		}
   		if(query.getUpdateTime()!=null){
   			hql.append(" and ett.updateTime=?");
   			param.add(query.getUpdateTime());
   		}
   	}
   	return this.findFastByHql(hql.toString(), param.toArray());
   }

}